<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<!--    1.引入axios源码文件-->
<script src="js/axios-0.18.0.js"></script>

<script>
    //2.使用Axios发送请求，并获取响应结果
    //①get请求
   /* axios({
        method: "get",
        url: "http://localhost:8080/ajax-demo/axiosServlet?username=zhangsan"
    }).then(function (resp) {
        alert(resp.data);
    })*/
    //②post请求
  /* axios({
       method:"post",
       url:"http://localhost:8080/ajax-demo/axiosServlet",
       data:"username=zhangsan"
   }).then(function (resp){
     alert(resp.data);
   })*/

    //使用Axios请求方式别名
    //①get
    /*axios.get("http://localhost:8080/ajax-demo/axiosServlet?username=zhangsan").then(function (resp) {
        alert(resp.data);
    })*/
    //②post
    axios.post("http://localhost:8080/ajax-demo/axiosServlet","username=zhangsan").then(function (resp) {
        alert(resp.data);
    })

</script>

</body>
</html>

<!--
弹幕说
js目录最好和html文件目录在同一级
-->